var consumeBrokenLine = echarts.init(document.getElementById('consumeBrokenLine'));

option = {
    backgroundColor:'#fff',
    title: [{
        text: city+'消费指数同比',
    }],
    tooltip: {
        trigger: 'axis',
        formatter:'{b}<br/>{a0}: {c0}%<br />{a1}: {c1}%<br />{a2}: {c2}%'
    },
    legend: {
        data:['总体消费指数同比', '食品消费指数同比', '衣着消费指数同比']
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {},
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {
                pixelRatio:5
            }
        }
    },
    xAxis:  {
        type: 'category',
        data: year
    },
    yAxis: {
        type: 'value',
        // min:-35,
        axisLabel: {
            formatter: '{value} %'
        }
    },
    series: [
        {
            name:'总体消费指数同比',
            type:'line',
            data:totalOfConsume
        },
        {
            name:'食品消费指数同比',
            type:'line',
            data:foodOfConsume
        },
        {
            name:'衣着消费指数同比',
            type:'line',
            data:clothesOfConsume
        }
    ]
};

consumeBrokenLine.setOption(option);

var priceBrokenLine = echarts.init(document.getElementById('priceBrokenLine'));

option = {
    backgroundColor:'#fff',
    title: [{
        text: city+'价格指数同比',
    }],
    tooltip: {
        trigger: 'axis',
        formatter:'{b}<br/>{a0}: {c0}%<br />{a1}: {c1}%<br />{a2}: {c2}%'
    },
    legend: {
        data:['总体价格指数同比', '食品价格指数同比', '衣着价格指数同比']
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {},
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {
                pixelRatio:5
            }
        }
    },
    xAxis:  {
        type: 'category',
        data: year
    },
    yAxis: {
        type: 'value',
        // min:-35,
        axisLabel: {
            formatter: '{value} %'
        }
    },
    series: [
        {
            name:'总体价格指数同比',
            type:'line',
            data:totalOfPrice
        },
        {
            name:'食品价格指数同比',
            type:'line',
            data:foodOfPrice
        },
        {
            name:'衣着价格指数同比',
            type:'line',
            data:clothesOfPrice
        }
    ]
};


priceBrokenLine.setOption(option);